const mongoose = require('mongoose')
const Schema = mongoose.Schema;

const boatSchema = new Schema({
    boatName: {type: String, required: true}, // 队伍名称
    bostAddress: {type: String, required: true}, // 队伍地址
    boatPhone: {type: String, required: true},  // 队伍联系电话
    boatRemarks: {type: String}, // 队伍备注
    boatPrincipal: {type: String},  // 队伍负责人联系电话
    boatMobile: {type: String},  // 队伍负责人的联系电话
    createrId: {type: String, required: true},// 登记人的id
    createrMobile: {type: String},// 登记人的电话
    updateId:  {type: String}, // 更新这id
    updateMobile:  {type: String}
}, {
    timestamps: {createdAt: 'created', updatedAt: 'updated'} 
})

boatSchema.methods.findBoat = function(name, callback) {
    return this.model('Boat').findOne({boatName: name}, callback)
}

module.exports = mongoose.model('Boat', boatSchema) 